home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / anywho.xml < prev    next >
Text File  |  2002-09-06  |  2KB  |  73 lines

  1. <search function="anywho">
  2.   <name>AnyWho</name>
  3.   <description>
  4.     Find a person or business by telephone number.<br/>
  5.     <div class="helpboxDescLabels">Example:</div>
  6.     <table class="helpboxDescTable">
  7.           <tr><td>anywho 972-555-1212</td></tr>
  8.       </table>
  9.   </description>
  10.   <category>People and Places</category>
  11.   <link>http://www.anywho.com/qry/wp_rl</link>
  12.   
  13.   <form name="anywhof"
  14.     action="http://www.anywho.com/qry/wp_rl"
  15.     method="get">
  16.     <input type="hidden" name="npa" value=""/>
  17.     <input type="hidden" name="telephone" value=""/>
  18.   </form>
  19.   
  20.   <script><![CDATA[
  21.     phone_regex = new RegExp("^([0-9]{3})\\s*[-.]?\\s*([0-9]{3}\\s*[-.]?\\s*[0-9]{4})\\s*$" +
  22.                              "|^\\(([0-9]{3})\\)\\s*([0-9]{3}\\s*-?\\s*[0-9]{4})\\s*$", "");
  23.  
  24.     // the auto-detection routine used for special handling of strings entered into the
  25.     // toolbar that look like phone number lookups
  26.     function autodetect_phone(q) 
  27.     {
  28.       // detect strings that look like phone numbers
  29.       res = phone_regex.exec(q);
  30.       if (res)
  31.       {
  32.         anywho(q);
  33.         return true;
  34.       }
  35.     }
  36.  
  37.     function anywho(q)
  38.     {
  39.       if( nullArgs("anywho",q) )
  40.         return false;
  41.       else
  42.       {
  43.         // detect strings that look like phone numbers
  44.         res = phone_regex.exec(q);
  45.         if (res)
  46.         {
  47.           if (res[1])
  48.           {
  49.             ac=res[1].replace( / /, "", "g");
  50.             pn=res[2].replace( / /, "", "g");
  51.           }
  52.           else
  53.           {
  54.             ac=res[3].replace( / /, "", "g");
  55.             pn=res[4].replace( / /, "", "g");;
  56.           }
  57.         document.anywhof.npa.value=ac;
  58.         document.anywhof.telephone.value=pn;
  59.         submitForm(anywhof);
  60.         }
  61.         else
  62.           return false;
  63.       }
  64.     }
  65.   ]]></script>
  66.  
  67.   <copyright>
  68.     Copyright (c) 2002 David Bau
  69.     Distributed under the terms of the
  70.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  71.   </copyright>
  72. </search>
  73.